package com.qianfeng.openplatform.webmaster.controller;

import com.qianfeng.openplatform.webmaster.entry.LayuiDataTableSource;
import com.qianfeng.openplatform.webmaster.entry.OpenApiMaster;
import com.qianfeng.openplatform.webmaster.pojo.ApiServiceParam;
import com.qianfeng.openplatform.webmaster.service.ApiServiceParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 江江
 * @Date 2020/7/27 11:43
 */
@RestController
@RequestMapping("/sys/service")
public class ApiServiceParamController {

    @Autowired
    private ApiServiceParamService apiServiceParamService;

    @RequestMapping("/table")
    public LayuiDataTableSource serviceParamTable(@RequestParam(defaultValue = "1")Integer page,
                                                  @RequestParam(defaultValue = "10")Integer limit){
        return apiServiceParamService.findApiserviceToPage(page,limit);
    }

    @RequestMapping("/add")
    public OpenApiMaster addService(ApiServiceParam apiServiceParam){
        return apiServiceParamService.addApiServiceParam(apiServiceParam);
    }

    @RequestMapping("/update")
    public OpenApiMaster updateService(ApiServiceParam apiServiceParam){
        return apiServiceParamService.updateApiServiceParam(apiServiceParam);
    }

    @RequestMapping("/del")
    public OpenApiMaster delService(int[] ids ){
        return apiServiceParamService.delApiServiceParam(ids);
    }
}
